export function friendlyDate(dateStr) {
    let dateObj = typeof dateStr === 'Object' ? dateStr : new Date(dateStr)
    let time = dateObj.getTime()
    let now = Date.now()
    let space = now - time
    let str = ''
   
    switch (true) {
        //小于1分钟
        case space < 60000:
            str = '刚刚'
            break
            //小于1小时
        case space < 3600 * 1000:
            str = Math.floor(space / 60000) + '分钟前'
            break
                //小于1天
        case space < (3600 * 1000 * 24):
            str = Math.floor(space / (3600 * 1000)) + '小时前'
            break
            //小于一个月
        default:
            str = Math.floor(space / (3600 * 1000 * 24)) + '天前'
            break
    }
    return str
}